<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <link rel="shortcut icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta content="telephone=no,email=no" name="format-detection" />
    <title>在线客服系统注册-{$business['business_name']|default=""}</title>
    <script>
        YMWL_ROOT_URL = '{$baseroot}';
    </script>
    <!--加载引用文件 -->
    <link href="__libs__/layer/admin/admin.css?v=__lkversion__" rel="stylesheet">
    <link href="__libs__/layer/admin/login.css?v=__lkversion__" rel="stylesheet">
    <link href="__libs__/layer/admin/layui.css?v=__lkversion__" rel="stylesheet">
    <link href="__libs__/layer/skin/layer.css?v=__lkversion__" type="text/css" rel="stylesheet" />
    <style>
        .layadmin-user-login {
            background-image: url(/assets/images/admin/noise.png), url(/assets/images/admin/1.jpg);
            background-repeat: repeat, no-repeat;
            background-position: left top;
            background-size: auto, cover;
        }
    </style>
</head>
<body>

<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-header">
            {if condition="$business && !empty($business['logo'])"}
            <img class="login-logo" src="{$business['logo']}">
            {/if}
            <h2>注册客服系统</h2>
        </div>
        <form method="post" action="{:url('regist')}" class="am-form" onsubmit="return false;">
            <div class="layadmin-user-login-body layui-form">
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-service" for="business_name"></label>
                    <input type="text" name="business_name" lay-verify="required" placeholder="商家名称" class="layui-input" id="business_name">
                </div>
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                    <input type="text" name="user_name" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
                </div>
                <div class="layui-form-item" id="login-input">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
                    <input type="password" id="password" name="password" lay-verify="required" placeholder="密码" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="rpassword"></label>
                    <input type="password" id="repassword" name="repassword" lay-verify="required" placeholder="确认密码" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <div class="layui-row">
                        <div class="layui-col-xs7">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
                            <input type="text" name="captcha" lay-verify="required" placeholder="图形验证码" class="layui-input" id="LAY-user-login-vercode">
                        </div>

                        <div class="layui-col-xs5">
                            <div style="margin-left: 10px;">
                                <img  id="login-captcha" src="{:url('captcha')}?t={:mt_rand()}" class="layadmin-user-login-codeimg" align="absmiddle" onclick="this.src='{:url('captcha')}?_r='+Math.random();" title="不清楚? 点击换一个"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <button id="login-submit" class="layui-btn layui-btn-fluid" lay-submit lay-filter="loginForm">立即注册</button>
                </div>
            </div>

            <div class="layui-form-item">
                <a href="{:url('admin/login/index')}" style="font-size: 1.3em;color: #000;">已有账号？点击登录</a>
            </div>

        </form>
    </div>

    <div class="layui-trans layadmin-user-login-footer">

        <p>{if condition="$business && (!empty($business['copyright']) || $business['copyright'] != '')"}{$business['copyright']}{else} © 2021 来客PHP在线客服系统{/if}</p>
    </div>
</div>
<script type="text/javascript" src="__libs__/jquery/jquery.min.js?v=__lkversion__"></script>
<script src="__libs__/layui/layui.js?v=__lkversion__" type="text/javascript"></script>
<script type="text/javascript" src="__libs__/layer/layer.js?v=__lkversion__"></script>
<script>
    var domCaptcha=$('#login-captcha');
    //Demo
    layui.use(["form"], function () {

        var form = layui.form;

        //监听提交
        form.on('submit(loginForm)', function (data) {
            $.ajax({
                type: "post",
                url: data.form.action,
                data: data.field,
                dataType: 'json',
                success: function (res) {
                    if (res.code == 1) {
                        layer.open({
                            type:1,
                            title:'信息',
                            content:'<p style="padding: 1.8em;width: 180px;">注册成功</p>',
                            btn:['登录'],
                            yes:function(){
                                window.location.href="{:url('admin/login/index')}";
                            }
                        });
                    } else {
                        layui.layer.msg(res.msg);
                        domCaptcha.click();
                    }
                }
            });
            return false;
        });
    });
</script>

</body>
</html>